$(document).ready(function(){


    Orbited.settings.hostname='m4it.pl/chat';

    stomp = new STOMPClient();
    stomp.onopen = function() {
    };
    stomp.onclose = function(c) { alert('Lost Connection, Code: ' + c);};
    stomp.onerror = function(error) {
        alert("Error: " + error);
    };
    stomp.onerrorframe = function(frame) {
        alert("Error: " + frame.body);
    };
    stomp.onconnectedframe = function() {
        stomp.subscribe("/chat");
    };
    stomp.onmessageframe = function(frame) {
        // Presumably we should only receive message frames with the
        // destination "/topic/graph" because thats the only destination
        // to which we've subscribed. To handle multiple destinations we
        // would have to check frame.headers.destination.
        modify_graph(bars, frame.body);
$('#chat').append('RECEIVE: ' + frame.body);
    };
    stomp.connect('m4it.pl/chat', 80);




//var conn = new Orbited.TCPSocket()
//Orbited.settings.hostname='m4it.pl/chat';
//Orbited.settings.port = 80
//conn.open('m4it.pl/chat', 80);
//conn= Orbited.TCPSocket;
//conn.onopen = function() { alert('connection opened!')
//conn.send('Hello World');
//}
//conn.onread = function(data) {$('#chat').append('RECEIVE: ' + data) }
//conn.onclose = function(data) { alert('connection closed!') }








});
